package com.qg.utils;

import org.apache.activemq.command.ActiveMQQueue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;

import javax.jms.Destination;


public class ActiveMQUtil {
    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;

    /**
     * 消息发送的方法
     * @param topic 消息主题
     * @param message 消息的本体内容
     */
    public void sendMessage(String topic,Object message){
        Destination destination =new ActiveMQQueue(topic);
        jmsMessagingTemplate.convertAndSend(destination);
    }
}

